<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Gym Rat | Equipment</title>
</head>
<body>
<jsp:include page="/includes/nav.jsp" />
<h1>Equipment Listing</h1>
<p>Below is a listing of all available Equipment. You may also
delete the equipment that you have created yourself. At the bottom of
the page is a form to create your own. The abbreviated equipment name is
used when an exercise has too much equipment to list, so make sure it is
short but unique.</p>
<form action="${pageContext.request.contextPath}/equipment/delete"
	method="post">
<table>
	<tr class="tableHeader">
		<td>Name</td>
		<td>Abbreviation</td>
		<td>Delete</td>
	</tr>
	<c:forEach var="equipment" items="${equipment}" varStatus="status">
		<c:choose>
			<c:when test="${status.count % 2 == 1 }">
				<c:set var="rowClass" value="tableOddRow" />
			</c:when>
			<c:otherwise>
				<c:set var="rowClass" value="tableEvenRow" />
			</c:otherwise>
		</c:choose>
		<tr class="${rowClass }">
			<td>${equipment.name }</td>
			<td>${equipment.shortName }</td>
			<td><c:if
				test='${(equipment.custom == true) || (user.admin == true)}'>
				<input type="checkbox" name="deleteBox" value="${equipment.id }" />
			</c:if> <c:if test='${(equipment.custom == true)}'>
			*</c:if></td>
		</tr>

	</c:forEach>
	<tr>
		<td colspan=5 align="right">*Custom Equipment</td>
	</tr>
	<tr>
		<td colspan=5 align="right"><input type="button" value="Delete"
			onClick="if(confirm('Really delete selected equipment?'))
	submit()"></td>
	</tr>
</table>
</form>
Create new equipment:
<form
	action="${pageContext.request.contextPath}/equipment/create/submit"
	method="post">
<table>
	<tr>
		<td>Name:</td>
		<td><input type="text" name="name"></td>
	</tr>
	<tr>
		<td>Abbreviated name</td>
		<td><input type="text" name="shortName"></td>
	</tr>
	<c:if test="${user.admin == true }">
		<tr>
			<td><input type="checkbox" name="public">Public
			Equipment?</td>
		</tr>
	</c:if>
	<tr>
		<td><input type="hidden" name="redir" value="${redir }">
		<input type="hidden" name="userId" value="${user.id }"> <input
			type="button" value="Create" onClick="submit()"></td>
	</tr>
</table>
</form>
</body>
</html>